import Page from "@/domain/bo/PageBO";
import JlPage from "@/domain/po/JlPage";
import Request from "@/api/Request";
import PathVariable from "@/domain/po/PathVariable";
import GlobalVariableMapVO from "@/domain/vo/GlobalVariableMapVO";
import GlobalVariableMapFormBO from "@/domain/bo/GlobalVariableMapFormBO";

class GlobalVariableMapService {
    /**
     * 列表查询
     */
    public list(page: Page): Promise<JlPage<GlobalVariableMapVO>> {
        return Request
            .build("/api/global/variable/map/pageList")
            .doGet({
                page: page.page,
                pageSize: page.pageSize
            });
    }

    /**
     * 获取数据
     * @param id
     */
    public get(id: string): Promise<GlobalVariableMapVO> {
        return Request
            .build("/api/global/variable/map/get/{id}")
            .pathVariable([new PathVariable("id", id)])
            .doGet(undefined);
    }

    /**
     * 添加
     */
    public add(bo: GlobalVariableMapFormBO) {
        return Request
            .build("/api/global/variable/map/add")
            .doPost(bo);
    }

    /**
     * 编辑
     */
    public edit(bo: GlobalVariableMapFormBO) {
        return Request
            .build("/api/global/variable/map/edit/{id}")
            .pathVariable([new PathVariable("id", bo.id)])
            .doPut(bo);
    }

    /**
     * 删除
     */
    public del(ids: string[]) {
        return Request
            .build("/api/global/variable/map/del")
            .doDelete(ids);
    }
}

export default new GlobalVariableMapService();